home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-SPAR.{_A / OPENPROM.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  7KB  |  282 lines

  1. /* $Id: openprom.h,v 1.7 1998/03/15 10:14:47 ecd Exp $ */
  2. #ifndef __SPARC64_OPENPROM_H
  3. #define __SPARC64_OPENPROM_H
  4.  
  5. /* openprom.h:  Prom structures and defines for access to the OPENBOOT
  6.  *              prom routines and data areas.
  7.  *
  8.  * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
  9.  */
  10.  
  11. /* Empirical constants... */
  12. #define KADB_DEBUGGER_BEGVM     0xffc00000    /* Where kern debugger is in virt-mem */
  13. #define    LINUX_OPPROM_BEGVM    0xffd00000
  14. #define    LINUX_OPPROM_ENDVM    0xfff00000
  15. #define    LINUX_OPPROM_MAGIC      0x10010407
  16.  
  17. #ifndef __ASSEMBLY__
  18. /* V0 prom device operations. */
  19. struct linux_dev_v0_funcs {
  20.     int (*v0_devopen)(char *device_str);
  21.     int (*v0_devclose)(int dev_desc);
  22.     int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
  23.     int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
  24.     int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
  25.     int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
  26.     int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
  27.     int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
  28.     int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
  29. };
  30.  
  31. /* V2 and later prom device operations. */
  32. struct linux_dev_v2_funcs {
  33.     int (*v2_inst2pkg)(int d);    /* Convert ihandle to phandle */
  34.     char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
  35.     void (*v2_dumb_mem_free)(char *va, unsigned sz);
  36.  
  37.     /* To map devices into virtual I/O space. */
  38.     char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
  39.     void (*v2_dumb_munmap)(char *virta, unsigned size);
  40.  
  41.     int (*v2_dev_open)(char *devpath);
  42.     void (*v2_dev_close)(int d);
  43.     int (*v2_dev_read)(int d, char *buf, int nbytes);
  44.     int (*v2_dev_write)(int d, char *buf, int nbytes);
  45.     int (*v2_dev_seek)(int d, int hi, int lo);
  46.  
  47.     /* Never issued (multistage load support) */
  48.     void (*v2_wheee2)(void);
  49.     void (*v2_wheee3)(void);
  50. };
  51.  
  52. struct linux_mlist_v0 {
  53.     struct linux_mlist_v0 *theres_more;
  54.     unsigned start_adr;
  55.     unsigned num_bytes;
  56. };
  57.  
  58. struct linux_mem_v0 {
  59.     struct linux_mlist_v0 **v0_totphys;
  60.     struct linux_mlist_v0 **v0_prommap;
  61.     struct linux_mlist_v0 **v0_available; /* What we can use */
  62. };
  63.  
  64. /* Arguments sent to the kernel from the boot prompt. */
  65. struct linux_arguments_v0 {
  66.     char *argv[8];
  67.     char args[100];
  68.     char boot_dev[2];
  69.     int boot_dev_ctrl;
  70.     int boot_dev_unit;
  71.     int dev_partition;
  72.     char *kernel_file_name;
  73.     void *aieee1;           /* XXX */
  74. };
  75.  
  76. /* V2 and up boot things. */
  77. struct linux_bootargs_v2 {
  78.     char **bootpath;
  79.     char **bootargs;
  80.     int *fd_stdin;
  81.     int *fd_stdout;
  82. };
  83.  
  84. /* The top level PROM vector. */
  85. struct linux_romvec {
  86.     /* Version numbers. */
  87.     unsigned int pv_magic_cookie;
  88.     unsigned int pv_romvers;
  89.     unsigned int pv_plugin_revision;
  90.     unsigned int pv_printrev;
  91.  
  92.     /* Version 0 memory descriptors. */
  93.     struct linux_mem_v0 pv_v0mem;
  94.  
  95.     /* Node operations. */
  96.     struct linux_nodeops *pv_nodeops;
  97.  
  98.     char **pv_bootstr;
  99.     struct linux_dev_v0_funcs pv_v0devops;
  100.  
  101.     char *pv_stdin;
  102.     char *pv_stdout;
  103. #define    PROMDEV_KBD    0        /* input from keyboard */
  104. #define    PROMDEV_SCREEN    0        /* output to screen */
  105. #define    PROMDEV_TTYA    1        /* in/out to ttya */
  106. #define    PROMDEV_TTYB    2        /* in/out to ttyb */
  107.  
  108.     /* Blocking getchar/putchar.  NOT REENTRANT! (grr) */
  109.     int (*pv_getchar)(void);
  110.     void (*pv_putchar)(int ch);
  111.  
  112.     /* Non-blocking variants. */
  113.     int (*pv_nbgetchar)(void);
  114.     int (*pv_nbputchar)(int ch);
  115.  
  116.     void (*pv_putstr)(char *str, int len);
  117.  
  118.     /* Miscellany. */
  119.     void (*pv_reboot)(char *bootstr);
  120.     void (*pv_printf)(__const__ char *fmt, ...);
  121.     void (*pv_abort)(void);
  122.     __volatile__ int *pv_ticks;
  123.     void (*pv_halt)(void);
  124.     void (**pv_synchook)(void);
  125.  
  126.     /* Evaluate a forth string, not different proto for V0 and V2->up. */
  127.     union {
  128.         void (*v0_eval)(int len, char *str);
  129.         void (*v2_eval)(char *str);
  130.     } pv_fortheval;
  131.  
  132.     struct linux_arguments_v0 **pv_v0bootargs;
  133.  
  134.     /* Get ether address. */
  135.     unsigned int (*pv_enaddr)(int d, char *enaddr);
  136.  
  137.     struct linux_bootargs_v2 pv_v2bootargs;
  138.     struct linux_dev_v2_funcs pv_v2devops;
  139.  
  140.     int filler[15];
  141.  
  142.     /* This one is sun4c/sun4 only. */
  143.     void (*pv_setctxt)(int ctxt, char *va, int pmeg);
  144.  
  145.     /* Prom version 3 Multiprocessor routines. This stuff is crazy.
  146.      * No joke. Calling these when there is only one cpu probably
  147.      * crashes the machine, have to test this. :-)
  148.      */
  149.  
  150.     /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
  151.      * 'thiscontext' executing at address 'prog_counter'
  152.      */
  153.     int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
  154.                int thiscontext, char *prog_counter);
  155.  
  156.     /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
  157.      * until a resume cpu call is made.
  158.      */
  159.     int (*v3_cpustop)(unsigned int whichcpu);
  160.  
  161.     /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
  162.      * resume cpu call is made.
  163.      */
  164.     int (*v3_cpuidle)(unsigned int whichcpu);
  165.  
  166.     /* v3_cpuresume() will resume processor 'whichcpu' executing
  167.      * starting with whatever 'pc' and 'npc' were left at the
  168.      * last 'idle' or 'stop' call.
  169.      */
  170.     int (*v3_cpuresume)(unsigned int whichcpu);
  171. };
  172.  
  173. /* Routines for traversing the prom device tree. */
  174. struct linux_nodeops {
  175.     int (*no_nextnode)(int node);
  176.     int (*no_child)(int node);
  177.     int (*no_proplen)(int node, char *name);
  178.     int (*no_getprop)(int node, char *name, char *val);
  179.     int (*no_setprop)(int node, char *name, char *val, int len);
  180.     char * (*no_nextprop)(int node, char *name);
  181. };
  182.  
  183. /* More fun PROM structures for device probing. */
  184. #define PROMREG_MAX     16
  185. #define PROMVADDR_MAX   16
  186. #define PROMINTR_MAX    15
  187.  
  188. struct linux_prom_registers {
  189.     unsigned which_io;    /* hi part of physical address            */
  190.     unsigned phys_addr;    /* The physical address of this register    */
  191.     int reg_size;        /* How many bytes does this register take up?    */
  192. };
  193.  
  194. struct linux_prom64_registers {
  195.     long phys_addr;
  196.     long reg_size;
  197. };
  198.  
  199. struct linux_prom_irqs {
  200.     int pri;    /* IRQ priority */
  201.     int vector; /* This is foobar, what does it do? */
  202. };
  203.  
  204. /* Element of the "ranges" vector */
  205. struct linux_prom_ranges {
  206.     unsigned int ot_child_space;
  207.     unsigned int ot_child_base;        /* Bus feels this */
  208.     unsigned int ot_parent_space;
  209.     unsigned int ot_parent_base;        /* CPU looks from here */
  210.     unsigned int or_size;
  211. };
  212.  
  213. /* Ranges and reg properties are a bit different for PCI. */
  214. struct linux_prom_pci_registers {
  215.     unsigned int phys_hi;
  216.     unsigned int phys_mid;
  217.     unsigned int phys_lo;
  218.  
  219.     unsigned int size_hi;
  220.     unsigned int size_lo;
  221. };
  222.  
  223. struct linux_prom_pci_ranges {
  224.     unsigned int child_phys_hi;    /* Only certain bits are encoded here. */
  225.     unsigned int child_phys_mid;
  226.     unsigned int child_phys_lo;
  227.  
  228.     unsigned int parent_phys_hi;
  229.     unsigned int parent_phys_lo;
  230.  
  231.     unsigned int size_hi;
  232.     unsigned int size_lo;
  233. };
  234.  
  235. struct linux_prom_pci_intmap {
  236.     unsigned int phys_hi;
  237.     unsigned int phys_mid;
  238.     unsigned int phys_lo;
  239.  
  240.     unsigned int interrupt;
  241.  
  242.     int          cnode;
  243.     unsigned int cinterrupt;
  244. };
  245.  
  246. struct linux_prom_pci_intmask {
  247.     unsigned int phys_hi;
  248.     unsigned int phys_mid;
  249.     unsigned int phys_lo;
  250.     unsigned int interrupt;
  251. };
  252.  
  253. struct linux_prom_ebus_ranges {
  254.     unsigned int child_phys_hi;
  255.     unsigned int child_phys_lo;
  256.  
  257.     unsigned int parent_phys_hi;
  258.     unsigned int parent_phys_mid;
  259.     unsigned int parent_phys_lo;
  260.  
  261.     unsigned int size;
  262. };
  263.  
  264. struct linux_prom_ebus_intmap {
  265.     unsigned int phys_hi;
  266.     unsigned int phys_lo;
  267.  
  268.     unsigned int interrupt;
  269.  
  270.     int          cnode;
  271.     unsigned int cinterrupt;
  272. };
  273.  
  274. struct linux_prom_ebus_intmask {
  275.     unsigned int phys_hi;
  276.     unsigned int phys_lo;
  277.     unsigned int interrupt;
  278. };
  279. #endif /* !(__ASSEMBLY__) */
  280.  
  281. #endif /* !(__SPARC64_OPENPROM_H) */
  282.